# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : zsj.py
# @Time     : 2024/4/10 21:48
# @Author   : Robot-Zsj
"""
description:

input
5 100 10
10 20 30 40 50
3 4 5 6 10
20 30 20 40 30

output
0 30 0 40 0
"""

import sys

m, n, x = map(int, input().split())  # 产品数，总投资，总风险

back = list(map(int, input().split()))

risk = list(map(int, input().split()))

invest = list(map(int, input().split()))

max_invest_back = 0

max_invest_back_risk = sys.maxsize

select = {}

for i in range(m):
    if risk[i] <= x:
        investI = min(invest[i], n)
        invest_back = investI * back[i]

        if invest_back > max_invest_back or (
                invest_back == max_invest_back and risk[i] < max_invest_back_risk
        ):
            max_invest_back = invest_back
            max_invest_back_risk = risk[i]
            select.clear()
            select[i] = investI
    else:
        continue

    for j in range(i + 1, m):
        if risk[i] + risk[j] <= x:
            investI = 0
            investJ = 0

            if back[i] > back[j]:
                investI = min(n, invest[i])
                investJ = min(n - investI, invest[j])
            elif back[i] < back[j]:
                investJ = min(n, invest[j])
                investI = min(n - investJ, invest[i])
            elif risk[i] > risk[j]:
                investJ = min(n, invest[j])
                investI = min(n - investJ, invest[i])
            else:
                investI = min(n, invest[i])
                investJ = min(n - investI, invest[j])

            invest_back = investI * back[i] + investJ * back[j]
            invest_back_risk = risk[i] + risk[j]

            if invest_back > max_invest_back or (
                    invest_back == max_invest_back and
                    invest_back_risk < max_invest_back_risk
            ):
                max_invest_back = invest_back
                max_invest_back_risk = invest_back_risk
                select.clear()

                if investI > 0:
                    select[i] = investI
                if investJ > 0:
                    select[j] = investJ

res = []

for i in range(m):
    if i in select:
        res.append(select[i])
    else:
        res.append(0)

print(" ".join(map(str, res)))
